using HKB.Common;
using System;
using System.Collections;
using System.Data;
using System.Data.SqlClient;
using System.Web;
namespace HKB.Data
{
	public class Pager
	{
		private Conn conn;
		public Pager()
		{
			this.conn = Text.GetComponent<Conn>("conn", HttpContext.Current.CurrentHandler);
		}
		public Pager(Conn _conn)
		{
			this.conn = _conn;
		}
		public DataTable Query(System.Collections.Hashtable QueryEntity)
		{
			SqlParameter[] parameters = new SqlParameter[]
			{
				new SqlParameter("@tblName", QueryEntity["tblName"].ToString()),
				new SqlParameter("@seleName", QueryEntity["seleName"].ToString()),
				new SqlParameter("@fldName", QueryEntity["fldName"].ToString()),
				new SqlParameter("@PageSize", QueryEntity["PageSize"].ToString()),
				new SqlParameter("@PageIndex", QueryEntity["PageIndex"].ToString()),
				new SqlParameter("@IsCount", QueryEntity["IsCount"].ToString()),
				new SqlParameter("@OrderType", QueryEntity["OrderType"].ToString()),
				new SqlParameter("@strWhere", QueryEntity["strWhere"].ToString())
			};
			return this.conn.GetDataTable("GetRecordFromPage", parameters);
		}
		public int QueryRecordCount(System.Collections.Hashtable QueryEntity)
		{
			SqlParameter[] parameters = new SqlParameter[]
			{
				new SqlParameter("@tblName", QueryEntity["tblName"].ToString()),
				new SqlParameter("@seleName", QueryEntity["seleName"].ToString()),
				new SqlParameter("@fldName", QueryEntity["fldName"].ToString()),
				new SqlParameter("@PageSize", QueryEntity["PageSize"].ToString()),
				new SqlParameter("@PageIndex", QueryEntity["PageIndex"].ToString()),
				new SqlParameter("@IsCount", QueryEntity["IsCount"].ToString()),
				new SqlParameter("@OrderType", QueryEntity["OrderType"].ToString()),
				new SqlParameter("@strWhere", QueryEntity["strWhere"].ToString())
			};
			return (int)this.conn.GetScalar("GetRecordFromPage", parameters);
		}
	}
}
